package internal

// Variables for holding default configurations of each settings
var (
	HotkeysTomlString  string
	ConfigTomlString   string
	DefaultThemeString string
)

// Generate and return model containing default configurations for interface
func defaultModelConfig(toggleDotFileBool bool, toggleFooter bool, firstFilePanelDir string) model {
	return model{
		filePanelFocusIndex: 0,
		focusPanel:          nonePanelFocus,
		processBarModel: processBarModel{
			process: make(map[string]process),
			cursor:  0,
			render:  0,
		},
		sidebarModel: sidebarModel{
			renderIndex: 0,
			directories: getDirectories(),
		},
		fileModel: fileModel{
			filePanels: []filePanel{
				{
					render:   0,
					cursor:   0,
					location: firstFilePanelDir,
					sortOptions: sortOptionsModel{
						width:  20,
						height: 4,
						open:   false,
						cursor: Config.DefaultSortType,
						data: sortOptionsModelData{
							options:  []string{"名称", "大小", "修改日期"},
							selected: Config.DefaultSortType,
							reversed: Config.SortOrderReversed,
						},
					},
					panelMode:       browserMode,
					focusType:       focus,
					directoryRecord: make(map[string]directoryRecord),
					searchBar:       generateSearchBar(),
				},
			},
			filePreview: filePreviewPanel{
				open: Config.DefaultOpenFilePreview,
			},
			width: 10,
		},
		helpMenu: helpMenuModal{
			renderIndex: 0,
			cursor:      1,
			data:        getHelpMenuData(),
			open:        false,
		},
		toggleDotFile: toggleDotFileBool,
		toggleFooter:  toggleFooter,
	}
}

// Return help menu for hotkeys
func getHelpMenuData() []helpMenuModalData {
	data := []helpMenuModalData{
		{
			subTitle: "常规",
		},
		{
			hotkey:         []string{"spf", ""},
			description:    "打开 superfile",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.Confirm,
			description:    "确认选择或输入",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.Quit,
			description:    "退出输入、模态框或 superfile",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ConfirmTyping,
			description:    "确认输入",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.CancelTyping,
			description:    "取消输入",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.OpenHelpMenu,
			description:    "打开帮助菜单（快捷键列表）",
			hotkeyWorkType: globalType,
		},
		{
			subTitle: "面板导航",
		},
		{
			hotkey:         hotkeys.CreateNewFilePanel,
			description:    "创建新文件面板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.CloseFilePanel,
			description:    "关闭当前焦点文件面板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ToggleFilePreviewPanel,
			description:    "切换文件预览面板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.OpenSortOptionsMenu,
			description:    "打开排序选项菜单",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ToggleReverseSort,
			description:    "切换反向排序",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ToggleFooter,
			description:    "切换底栏显示",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.NextFilePanel,
			description:    "聚焦到下一个文件面板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.PreviousFilePanel,
			description:    "聚焦到上一个文件面板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FocusOnProcessBar,
			description:    "聚焦到进程栏",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FocusOnSidebar,
			description:    "聚焦到侧边栏",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FocusOnMetaData,
			description:    "聚焦到元数据面板",
			hotkeyWorkType: globalType,
		},
		{
			subTitle: "面板操作",
		},
		{
			hotkey:         hotkeys.ListUp,
			description:    "向上",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ListDown,
			description:    "向下",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ParentDirectory,
			description:    "返回上级目录",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FilePanelSelectAllItem,
			description:    "选择当前面板所有项目",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FilePanelSelectModeItemsSelectUp,
			description:    "向上选择",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FilePanelSelectModeItemsSelectDown,
			description:    "向下选择",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ToggleDotFile,
			description:    "切换隐藏文件显示",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.SearchBar,
			description:    "切换搜索栏",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ChangePanelMode,
			description:    "在选择模式和普通模式间切换",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.PinnedDirectory,
			description:    "固定/取消固定文件夹到侧边栏（自动保存）",
			hotkeyWorkType: globalType,
		},
		{
			subTitle: "文件操作",
		},
		{
			hotkey:         hotkeys.FilePanelItemCreate,
			description:    "创建文件或文件夹（以/结尾创建文件夹）",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.FilePanelItemRename,
			description:    "重命名文件或文件夹",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.CopyItems,
			description:    "复制选中项目到剪贴板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.CutItems,
			description:    "剪切选中项目到剪贴板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.PasteItems,
			description:    "粘贴剪贴板内容到当前面板",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.DeleteItems,
			description:    "删除选中项目",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.CopyPath,
			description:    "复制当前文件或目录路径",
			hotkeyWorkType: globalType,
		},
		{
			hotkey:         hotkeys.ExtractFile,
			description:    "解压压缩文件",
			hotkeyWorkType: normalType,
		},
		{
			hotkey:         hotkeys.CompressFile,
			description:    "压缩文件或文件夹为.zip文件",
			hotkeyWorkType: normalType,
		},
		{
			hotkey:         hotkeys.OpenFileWithEditor,
			description:    "用默认编辑器打开文件",
			hotkeyWorkType: normalType,
		},
		{
			hotkey:         hotkeys.OpenCurrentDirectoryWithEditor,
			description:    "用默认编辑器打开当前目录",
			hotkeyWorkType: normalType,
		},
	}

	return data
}
